package com.utc.teamcenter.common.app.dialog.bean;

import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JComboBox;
import javax.swing.JComponent;

public class BeanJComboBox extends BeanComponent{
	
	JComboBox jcomboBox = new JComboBox();

	public JComboBox getJcomboBox() {
		return jcomboBox;
	}

	public BeanJComboBox(String key, String name, List<String> items) {
		super(key, name);
		for(String item :items){
			this.jcomboBox.addItem(item);
		}
		
		// TODO Auto-generated constructor stub
	}

	@Override
	public void clear() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public JComponent getComponent() {
		// TODO Auto-generated method stub
		return this.jcomboBox;
	}

	@Override
	public String getText() {
		Object value = this.jcomboBox.getSelectedItem();
		
		if (value == null) {
			return null;
		}
		
		return value.toString();		
	}

	@Override
	public boolean isRequired() {
		return false;
	}

	@Override
	public void requestFocus() {
		this.jcomboBox.requestFocus();
	}

	@Override
	public void setEnabled(boolean bool) {
		this.jcomboBox.setEnabled(bool);
	}

	@Override
	public void setRequired(boolean required) {
		
	}

	@Override
	public void setText(String text) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setVisible(boolean bool) {
		this.jcomboBox.setVisible(bool);
	}

}
